package cn.iocoder.yudao.module.trade.dal.mysql.stationinfo;


import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.trade.controller.admin.stationinfo.vo.StationInfoPageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.stationinfo.vo.StationInfoReqVO;
import cn.iocoder.yudao.module.trade.dal.dataobject.stationinfo.StationInfoDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;

/**
 * 气站信息 Mapper
 */
@Mapper
public interface StationInfoMapper extends BaseMapperX<StationInfoDO> {

    default PageResult<StationInfoDO> selectPage(StationInfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StationInfoDO>()
                .eqIfPresent(StationInfoDO::getCode, reqVO.getCode())
                .likeIfPresent(StationInfoDO::getAddress, reqVO.getAddress())
                .eqIfPresent(StationInfoDO ::getHeadId, reqVO.getHeadId())
                .likeIfPresent(StationInfoDO::getHeader, reqVO.getHeader())
                .eqIfPresent(StationInfoDO::getMobile, reqVO.getMobile())
                .eqIfPresent(StationInfoDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(StationInfoDO::getStatus, reqVO.getStatus())
                .eqIfPresent(StationInfoDO::getUpdater, reqVO.getUpdater())
                .orderByDesc(StationInfoDO::getId));
    }

    /**
     *  查询列表
     * @param stationInfoReqVO
     * @return
     */
    default List<StationInfoDO> selectList(StationInfoReqVO stationInfoReqVO) {
        return selectList(new LambdaQueryWrapperX<StationInfoDO>()
                .eqIfPresent(StationInfoDO::getCode, stationInfoReqVO.getCode())
                .likeIfPresent(StationInfoDO::getAddress, stationInfoReqVO.getAddress())
                .eq(StationInfoDO ::getHeadId, stationInfoReqVO.getHeadId())
                .likeIfPresent(StationInfoDO::getHeader, stationInfoReqVO.getHeader())
                .eqIfPresent(StationInfoDO::getMobile, stationInfoReqVO.getMobile())
                .eqIfPresent(StationInfoDO::getDeptId, stationInfoReqVO.getDeptId())
                .eqIfPresent(StationInfoDO::getStatus, stationInfoReqVO.getStatus())
                .eqIfPresent(StationInfoDO::getUpdater, stationInfoReqVO.getUpdater())
                .orderByDesc(StationInfoDO::getId));
    }

    List<StationInfoPageReqVO> getStationInfoList(StationInfoPageReqVO pageReqVO);
}
